gtkcontainer: clarify requirements for implementations
authorCarlos Soriano <csoriano@gnome.org>
Wed, 11 Nov 2015 10:37:28 +0000 (11:37 +0100)
committerCarlos Soriano <csoriano@gnome.org>
Mon, 16 Nov 2015 16:18:00 +0000 (17:18 +0100)
Spent quite a few time investigating why the widgets were
not shown in my GtkContainer implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=758087

gtk/gtkcontainer.c

index 30a6d1ef79be87d96f0b07503577401a9561e5fd..9c4b81d70a3f04072b4eda83127b2b11e8c6a575 100644 (file)
  * children in a horizontal row, and a #GtkGrid arranges the widgets it contains
  * in a two-dimensional grid.
  *
+ * For implementations of #GtkContainer the virtual method #GtkContainerClass.forall()
+ * is always required, since it's used for drawing and other internal operations
+ * on the children.
+ * If the #GtkContainer implementation expect to have non internal children
+ * it's needed to implement both #GtkContainerClass.add() and #GtkContainerClass.remove().
+ * If the GtkContainer implementation has internal children, they should be added
+ * with gtk_widget_set_parent() on init() and removed with gtk_widget_unparent()
+ * in the #GtkWidgetClass.destroy() implementation.
+ * See more about implementing custom widgets at https://wiki.gnome.org/HowDoI/CustomWidgets
+ *
  * # Height for width geometry management
  *
  * GTK+ uses a height-for-width (and width-for-height) geometry management system.